<?php
class FloorAction extends BaseAction
{
    public function index()
    {
    }

    /**
     * 根据商场获取楼层资讯
     * @author Ice <iceinto@mallog.com.cn>
     */
    public function mall()
    {
        $filelds = $this->getFields();
        $FloorModel = D('Floor');
        $MarketModel = D('Market');
        $mid = $this->_get('mid', 'intval');
        if(empty($mid)){
            $this->dataReturn('商场标识错误', 0, 0);
        }
        //获取商场信息
        $mall = $MarketModel->getById($mid);
        if(empty($mall)){
            $this->dataReturn('找不到商场', 0, 0);
        }
        //获取楼层信息
        $floors = $FloorModel->getList($mid);
        $data = array();
        $data['mall'] = $mall;
        $data['floors'] = $floors;
        $this->dataReturn($data, 0, 1);
    }

    /**
     * 获取商场楼层品牌列表
     * @author Ice <iceinto@mallog.com.cn>
     */
    public function brands()
    {
        $mid = $this->_get('mid', 'intval');
        $fid = $this->_get('fid', 'intval');
        if ($mid && $fid) {
            $brandNews = D('BrandNews')->getBrandConsult($mid, $fid);
            foreach ($brandNews as $key => $new) {
                unset($brandNews[$key]['image']);
                unset($brandNews[$key]['small_image']);
            }
            $this->dataReturn($brandNews, 0, 1);
        } else {
            $this->dataReturn('数据提供不对', 0, 0);
        }
    }
}

?>
